home *** CD-ROM | disk | FTP | other *** search
/ Chip: 2005 Utilities / CHIP Utilities 2005.7z / CHIP Utilities 2005.iso / docs / ptsdedit / www.geocities.com / js_source / pu5geo.js
Encoding:
Text File  |  2004-08-04  |  1.9 KB  |  78 lines

  1.  
  2. var PUisIE_NAV4 = false;
  3. if (parseFloat(navigator.appVersion) >= 4) {
  4.     PUisIE_NAV4 = true;
  5. }
  6.  
  7. var PUwinWidth='740';
  8. var PUwinHeight='300';
  9.  
  10. var PUtimes = 1;  /* number of times to show ad.  if > times, then redirect thru */
  11. var PUtheDomain = ".geocities.com";
  12. var PUexpiresIn = 4/24; /* days between shows of the ad */
  13.  
  14. function PUsetCook(t,expIn) {
  15.     var cook;
  16.     var PUexDate;
  17.     PUexDate = new Date;
  18.     PUexDate.setTime(PUexDate.getTime() + expIn*24*60*60*1000);
  19.     cook = "PU=t="+t+"; expires=" + PUexDate.toGMTString() +"; domain="+PUtheDomain + "; path=/";
  20.     document.cookie = cook;
  21. }
  22.  
  23. var PU_NO_COOKIES = 2;
  24.  
  25. function PUgetCook(x) {
  26.     var i,j,a,b,s,e,d,f;
  27.     a = document.cookie;
  28.     //if (a == "") return PU_NO_COOKIES;
  29.     s = a.indexOf(x + "=");
  30.     if (s == -1) return false;
  31.     s += x.length+1;
  32.     e = a.indexOf(';',s);
  33.     if (e == -1) e = a.length;
  34.     return a.substring(s,e);
  35. }
  36.  
  37. /* check cookies - if cookies are off or if user saw it X times, then we redirect thru */
  38.  
  39. var PUd;
  40. var PUb=PUgetCook("PU");
  41. var PUoverTimes = 0;
  42.  
  43. if (PUb == PU_NO_COOKIES) {
  44.     PUoverTimes = 1;
  45. } else {
  46.     if (PUb != false) {
  47.         PUb = PUb.split('&');
  48.         for (PUi=0; PUi<PUb.length; PUi++) {
  49.             PUd = PUb[PUi].split('=');
  50.             if (PUd == "t") {
  51.                   last;
  52.             }
  53.         }
  54.         PUd[1]++;
  55.         if (PUd[1] > PUtimes) {
  56.             PUoverTimes = 1;
  57.         } else {
  58.             PUsetCook(PUd[1],PUexpiresIn);
  59.     }
  60.     } else {
  61.            PUsetCook(1,PUexpiresIn);
  62.     }
  63. }
  64.  
  65. function PUlaunchPU(){
  66.     var PUwin;
  67.     var addIt = PUisIE_NAV4 ? ',top=5000,left=5000' : '';
  68.     PUwin=window.open('about:blank','PUwin', 'width='+PUwinWidth+',height='+PUwinHeight+',location=no,menubar=no,titlebar=no,status=no,toolbar=no,scrollbars=yes,resizable=no'+addIt,true);
  69.     PUwin.blur();
  70.     return PUwin;
  71. }
  72.  
  73. if (PUoverTimes < 1) {
  74.     document.write('<script src="http://us.adserver.yahoo.com/a?f='+PUpage+'&p='+PUprop+'&l=PUC&c=o&bg=ffffff" language=javascript></');
  75.     document.write('script>');
  76. }
  77.  
  78.